<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="AccountEditDlg" widgetVar="AccountEditDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.EditAccountTitle}">
            <h:form id="AccountEditForm">
                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{accountController.selected != null}">
                        <p:outputLabel value="#{bundle.EditAccountLabel_id}" for="id" />
                        <p:inputText id="id" value="#{accountController.selected.id}" title="#{bundle.EditAccountTitle_id}" required="true" requiredMessage="#{bundle.EditAccountRequiredMessage_id}"/>
                        <p:outputLabel value="#{bundle.EditAccountLabel_username}" for="username" />
                        <p:inputText id="username" value="#{accountController.selected.username}" title="#{bundle.EditAccountTitle_username}" />
                        <p:outputLabel value="#{bundle.EditAccountLabel_password}" for="password" />
                        <p:inputText id="password" value="#{accountController.selected.password}" title="#{bundle.EditAccountTitle_password}" />
                        <p:outputLabel value="#{bundle.EditAccountLabel_email}" for="email" />
                        <p:inputText id="email" value="#{accountController.selected.email}" title="#{bundle.EditAccountTitle_email}" />
                        <p:outputLabel value="#{bundle.EditAccountLabel_roleId}" for="roleId" />
                        <p:selectOneMenu id="roleId" value="#{accountController.selected.roleId}" >
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{roleController.itemsAvailableSelectOne}"
                                           var="roleIdItem"
                                           itemValue="#{roleIdItem}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{accountController.update}" value="#{bundle.Save}" update="display,:AccountListForm:datalist,:growl" oncomplete="handleSubmit(args, 'AccountEditDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="AccountEditDialog.hide()"/>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
